package com.fit.hibernate;

import java.io.Serializable;
import java.util.Collection;

import org.hibernate.Criteria;
import org.hibernate.Session;

import com.fit.beans.ClientAddressBean;
import com.fit.interfaces.CityI;
import com.fit.interfaces.ClientAddressI;
import com.fit.service.ClientsAddressIservice;

public class ClientAddressServiceHibernate implements ClientsAddressIservice {

	private Session session;
	
	
	
	public ClientAddressServiceHibernate(Session session) {
		this.session = session;
	}

	public ClientAddressI save(ClientAddressI clientAddress) {
		
		return (ClientAddressI) session.get(ClientAddressBean.class, session.save(clientAddress));
	}

	public Collection<ClientAddressI> retrive() {
		Criteria criteria = session.createCriteria(ClientAddressBean.class);
		return criteria.list();
	}

	public ClientAddressI retriveSingleClientAddress(Serializable streetId) {
		
		return (ClientAddressI) session.get(ClientAddressBean.class, streetId);
	}

	

}
